package edu.zju.gis.dbfg.fileserver.service.impl;

import com.github.pagehelper.PageHelper;
import edu.zju.gis.dbfg.common.Page;
import edu.zju.gis.dbfg.common.base.BaseServiceImpl;
import edu.zju.gis.dbfg.fileserver.mapper.ConstructedDatasetMapper;
import edu.zju.gis.dbfg.fileserver.model.ConstructedDataset;
import edu.zju.gis.dbfg.fileserver.service.ConstructedDatasetService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class ConstructedDatasetServicelmpl extends BaseServiceImpl<ConstructedDatasetMapper, ConstructedDataset, String> implements ConstructedDatasetService {
    public int insert(ConstructedDataset c) {
        return this.mapper.insert(c);
    }

    public Page<ConstructedDataset> selectByPage(String userId, Page page) {
        PageHelper.startPage(page.getPageNo(), page.getPageSize());
        return new Page<>(this.mapper.selectAll(userId));
    }

    public Page<ConstructedDataset> selectByPageFinish(String userId, Page page) {
        PageHelper.startPage(page.getPageNo(), page.getPageSize());
        return new Page<>(this.mapper.selectAllFinish(userId));
    }

    public Page<ConstructedDataset> selectAllPublicFinish(String userId,Page page) {
        PageHelper.startPage(page.getPageNo(), page.getPageSize());
        return new Page<>(this.mapper.selectAllPublicFinish(userId));
    }

    public int updateSizeById(ConstructedDataset c) {
        return this.mapper.updateSizeById(c);
    }


    public int updateByPrimaryKey(ConstructedDataset record) {
        return this.mapper.updateByPrimaryKey(record);
    }

    public  int deleteByPrimaryKey(String id){
        return this.mapper.deleteByPrimaryKey(id);
    }
}
